home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7158 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: wdl1.wdl.loral.com!dst17!mab
  2. From: mab@dst17.wdl.loral.com (Mark A Biggar)
  3. Newsgroups: comp.lang.ada,comp.lang.c++
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. Date: 21 Feb 1996 22:30:02 GMT
  6. Organization: Loral Western Development Labs
  7. Distribution: world
  8. Message-ID: <4gg6da$8jk@wdl1.wdl.loral.com>
  9. References: <4gbq7q$g08@qualcomm.com> <4gdidj$10f5@watnews1.watson.ibm.com>
  10. NNTP-Posting-Host: dst17.wdl.loral.com
  11.  
  12. In article <4gdidj$10f5@watnews1.watson.ibm.com> ncohen@watson.ibm.com writes:
  13. >   package Parent is
  14. >      type Auxiliary_Type is ...;
  15. >      type P is tagged ...;
  16. >      procedure Op (X: in out P; Y: in Auxiliary_Type);
  17. >      ...
  18. >   end Parent;
  19. >
  20. >   package Parent.Child is
  21. >      type D is new P with ...;
  22. >      procedure Op (X: in out D; Y: in Auxiliary_Type);
  23. >      ...
  24. >   end Parent.Child;
  25. >
  26. >A compilation unit that mentions Parent.Child in a with clause is, in
  27. >effect, really importing a version of Parent with Parent.Child nested
  28. >inside of it, so the declaration of Auxiliary_Type comes along.
  29.  
  30. Given the above example, is the following code legal, I have been unable to 
  31. determine if it is from the RM95:
  32.  
  33. with Parent.Child;
  34. package My_Package is
  35.  
  36.   A: Parent.Child.Auxiliary_Type;  -- or must I say A: Parent.Auxiliary_Type
  37.  
  38. end My_Package;
  39.  
  40. If the above is illegal then it presents a problem if I have a library
  41. level renaming of Parent.Child, like so:
  42.  
  43. package My_Child renames Parent.Child;
  44.  
  45. with My_Child;
  46. package Foo is
  47.  
  48.   A: My_Child.Auxiliary_Type; -- LEGAL?
  49.  
  50. end Foo;
  51.  
  52. If this type of naming is legal then there is a simple emulation of
  53. Norman's multi-part package proposal using child packages and a library
  54. level rename.
  55.  
  56. --
  57. Mark Biggar
  58. mab@wdl.loral.com
  59.  
  60.  
  61.  
  62.  
  63.